<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="cluster-mode-quick-start" />
	<meta name="description" content="cluster-mode-quick-start" />
	<!-- 网页标签标题 -->
	<title>cluster-mode-quick-start</title>
	<link rel="shortcut icon" href="/img/nacos.ico"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot="" data-reactid="1" data-react-checksum="141631461"><header class="header-container header-container-normal" data-reactid="2"><div class="header-body" data-reactid="3"><a href="/zh-cn/index.html" data-reactid="4"><img class="logo" src="/img/nacos_colorful.png" data-reactid="5"/></a><span class="language-switch language-switch-normal" data-reactid="6">En</span><div class="header-menu" data-reactid="7"><img class="header-menu-toggle" src="/img/menu_gray.png" data-reactid="8"/><ul data-reactid="9"><li class="menu-item menu-item-normal" data-reactid="10"><a href="/zh-cn/index.html" data-reactid="11">首页</a></li><li class="menu-item menu-item-normal menu-item-normal-active" data-reactid="12"><a href="/zh-cn/docs/what-is-nacos.html" data-reactid="13">文档</a></li><li class="menu-item menu-item-normal" data-reactid="14"><a href="/zh-cn/blog/index.html" data-reactid="15">博客</a></li><li class="menu-item menu-item-normal" data-reactid="16"><a href="/zh-cn/community/index.html" data-reactid="17">社区</a></li><li class="menu-item menu-item-normal" data-reactid="18"><a href="http://console.nacos.io/nacos/index.html" data-reactid="19">控制台样例</a></li></ul></div></div></header><div class="bar" data-reactid="20"><div class="bar-body" data-reactid="21"><img src="/img/docs.png" class="front-img" data-reactid="22"/><div class="bar-title" data-reactid="23"><span data-reactid="24">Nacos 文档</span><div class="bone bone-light" data-reactid="25"></div></div><img src="/img/docs.png" class="back-img" data-reactid="26"/></div></div><section class="content-section" data-reactid="27"><div class="content-body" data-reactid="28"><div class="sidemenu" data-reactid="29"><div class="sidemenu-toggle" data-reactid="30"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png" data-reactid="31"/></div><ul data-reactid="32"><li class="menu-item menu-item-level-1" data-reactid="33"><span data-reactid="34">Nacos </span><ul data-reactid="35"><li style="height:144px;overflow:hidden;" class="menu-item menu-item-level-2" data-reactid="36"><span data-reactid="37"><!-- react-text: 38 -->Nacos是什么?<!-- /react-text --><img style="transform:rotate(0deg);" class="menu-toggle" src="/img/arrow_down.png" data-reactid="39"/></span><ul data-reactid="40"><li class="menu-item menu-item-level-3" data-reactid="41"><a href="/zh-cn/docs/what-is-nacos.html" target="_self" data-reactid="42">Nacos简介</a></li><li class="menu-item menu-item-level-3" data-reactid="43"><a href="/zh-cn/docs/concepts.html" target="_self" data-reactid="44">概念</a></li><li class="menu-item menu-item-level-3" data-reactid="45"><a href="/zh-cn/docs/architecture.html" target="_self" data-reactid="46">架构</a></li></ul></li><li style="height:216px;overflow:hidden;" class="menu-item menu-item-level-2" data-reactid="47"><span data-reactid="48"><!-- react-text: 49 -->快速开始<!-- /react-text --><img style="transform:rotate(0deg);" class="menu-toggle" src="/img/arrow_down.png" data-reactid="50"/></span><ul data-reactid="51"><li class="menu-item menu-item-level-3" data-reactid="52"><a href="/zh-cn/docs/quick-start.html" target="_self" data-reactid="53">快速开始</a></li><li class="menu-item menu-item-level-3" data-reactid="54"><a href="/zh-cn/docs/quick-start-spring.html" target="_self" data-reactid="55">Nacos Spring</a></li><li class="menu-item menu-item-level-3" data-reactid="56"><a href="/zh-cn/docs/quick-start-spring-boot.html" target="_self" data-reactid="57">Nacos Spring Boot</a></li><li class="menu-item menu-item-level-3" data-reactid="58"><a href="/zh-cn/docs/quick-start-spring-cloud.html" target="_self" data-reactid="59">Nacos Spring Cloud</a></li><li class="menu-item menu-item-level-3" data-reactid="60"><a href="/zh-cn/docs/quick-start-docker.html" target="_self" data-reactid="61">Nacos Docker</a></li></ul></li><li style="height:180px;overflow:hidden;" class="menu-item menu-item-level-2" data-reactid="62"><span data-reactid="63"><!-- react-text: 64 -->用户指南<!-- /react-text --><img style="transform:rotate(0deg);" class="menu-toggle" src="/img/arrow_down.png" data-reactid="65"/></span><ul data-reactid="66"><li class="menu-item menu-item-level-3" data-reactid="67"><a href="/zh-cn/docs/sdk.html" target="_self" data-reactid="68">Java的SDK</a></li><li class="menu-item menu-item-level-3" data-reactid="69"><a href="/zh-cn/docs/other-language.html" target="_self" data-reactid="70">其他语言的SDK</a></li><li class="menu-item menu-item-level-3" data-reactid="71"><a href="/zh-cn/docs/open-API.html" target="_self" data-reactid="72">Open-API指南</a></li><li class="menu-item menu-item-level-3" data-reactid="73"><a href="/zh-cn/docs/nacos-spring.html" target="_self" data-reactid="74">Nacos Spring</a></li></ul></li><li style="height:36px;overflow:hidden;" class="menu-item menu-item-level-2" data-reactid="75"><span data-reactid="76"><!-- react-text: 77 -->运维指南<!-- /react-text --><img style="transform:rotate(-90deg);" class="menu-toggle" src="/img/arrow_down.png" data-reactid="78"/></span><ul data-reactid="79"><li class="menu-item menu-item-level-3" data-reactid="80"><a href="/zh-cn/docs/deployment.html" target="_self" data-reactid="81">部署手册</a></li><li class="menu-item menu-item-level-3" data-reactid="82"><a href="/zh-cn/docs/cluster-mode-quick-start.html" target="_self" data-reactid="83">集群部署说明</a></li><li class="menu-item menu-item-level-3" data-reactid="84"><a href="/zh-cn/docs/managementAPI.html" target="_self" data-reactid="85">运维API</a></li><li class="menu-item menu-item-level-3" data-reactid="86"><a href="/zh-cn/docs/CLI-guide.html" target="_self" data-reactid="87">命令行手册</a></li><li class="menu-item menu-item-level-3" data-reactid="88"><a href="/zh-cn/docs/console-guide.html" target="_self" data-reactid="89">控制台手册</a></li></ul></li><li style="height:36px;overflow:hidden;" class="menu-item menu-item-level-2" data-reactid="90"><span data-reactid="91"><!-- react-text: 92 -->开源共建<!-- /react-text --><img style="transform:rotate(-90deg);" class="menu-toggle" src="/img/arrow_down.png" data-reactid="93"/></span><ul data-reactid="94"><li class="menu-item menu-item-level-3" data-reactid="95"><a href="/zh-cn/docs/contributing.html" target="_self" data-reactid="96">贡献源码</a></li><li class="menu-item menu-item-level-3" data-reactid="97"><a href="/zh-cn/docs/activity.html" target="_self" data-reactid="98">Nacos有奖活动介绍</a></li><li class="menu-item menu-item-level-3" data-reactid="99"><a href="/zh-cn/docs/pull-request.html" target="_self" data-reactid="100">pull request模板</a></li><li class="menu-item menu-item-level-3" data-reactid="101"><a href="/zh-cn/docs/how-to-reporting-bugs.html" target="_self" data-reactid="102">如何提交问题报告</a></li><li class="menu-item menu-item-level-3" data-reactid="103"><a href="/zh-cn/docs/roadmap.html" target="_self" data-reactid="104">Nacos规划</a></li><li class="menu-item menu-item-level-3" data-reactid="105"><a href="/zh-cn/docs/use-nacos-with-springcloud.html" target="_self" data-reactid="106">Nacos支持SpringCloud生态</a></li><li class="menu-item menu-item-level-3" data-reactid="107"><a href="/zh-cn/docs/use-nacos-with-dubbo.html" target="_self" data-reactid="108">nacos支持dubbo生态</a></li><li class="menu-item menu-item-level-3" data-reactid="109"><a href="/zh-cn/docs/use-nacos-with-kubernetes.html" target="_self" data-reactid="110">Nacos支持k8s</a></li><li class="menu-item menu-item-level-3" data-reactid="111"><a href="/zh-cn/docs/use-nacos-with-istio.html" target="_self" data-reactid="112">nacos支持istio</a></li></ul></li><li style="height:36px;overflow:hidden;" class="menu-item menu-item-level-2" data-reactid="113"><span data-reactid="114"><!-- react-text: 115 -->社区<!-- /react-text --><img style="transform:rotate(-90deg);" class="menu-toggle" src="/img/arrow_down.png" data-reactid="116"/></span><ul data-reactid="117"><li class="menu-item menu-item-level-3" data-reactid="118"><a href="/zh-cn/docs/community.html" target="_self" data-reactid="119">社区</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body" data-reactid="120"><h2>集群模式部署</h2>
<p>这个快速开始手册是帮忙您快速在你的电脑上，下载安装并使用Nacos，部署生产使用的集群模式。</p>
<h2>1.预备环境准备</h2>
<p>请确保是在环境中安装使用:</p>
<ol>
<li>64 bit OS  Linux/Unix/Mac，推荐使用Linux系统。</li>
<li>64 bit JDK 1.8+；<a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">下载</a>.<a href="https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/">配置</a>。</li>
<li>Maven 3.2.x+；<a href="https://maven.apache.org/download.cgi">下载</a>.<a href="https://maven.apache.org/settings.html">配置</a>。</li>
</ol>
<h2>2.下载源码或者安装包</h2>
<p>你可以通过两种方式来获取 Nacos。</p>
<h3>从 Github 上下载源码方式</h3>
<pre><code class="language-bash">unzip nacos-source.zip
<span class="hljs-built_in">cd</span> nacos/
mvn -Prelease-nacos clean install -U  
<span class="hljs-built_in">cd</span> nacos/distribution/target/nacos-server-0.7.0/nacos/bin
</code></pre>
<h3>下载编译后压缩包方式</h3>
<p>下载地址</p>
<p><a href="https://github.com/alibaba/nacos/releases/download/0.7.0/nacos-server-0.7.0.zip">zip包</a></p>
<p><a href="https://github.com/alibaba/nacos/releases/download/0.7.0/nacos-server-0.7.0.tar.gz">tar.gz包</a></p>
<pre><code class="language-bash">  unzip nacos-server-0.7.0.zip 或者 tar -xvf nacos-server-0.7.0.tar.gz
  <span class="hljs-built_in">cd</span> nacos/bin
</code></pre>
<h2>3.配置集群配置文件</h2>
<p>在nacos的解压目录nacos/的conf目录下，有配置文件cluster.conf，请每行配置成ip:port。</p>
<pre><code class="language-plain"># ip:port
200.8.9.16:8848
200.8.9.17:8848
200.8.9.18:8848
</code></pre>
<h2>4.配置mysql数据库</h2>
<p><span data-type="color" style="color:rgb(25, 31, 37)"><span data-type="background" style="background-color:rgb(255, 255, 255)">生产使用建议至少主备模式，或者采用高可用数据库。</span></span></p>
<h3>初始化mysql数据库</h3>
<p><a href="https://github.com/alibaba/nacos/blob/master/distribution/conf/nacos-mysql.sql">sql语句源文件</a></p>
<h3>application.properties 配置</h3>
<p><a href="https://github.com/alibaba/nacos/blob/master/distribution/conf/application.properties">application.properties配置文件</a></p>
<h2>5.启动服务器</h2>
<h3>Linux/Unix/Mac</h3>
<p>启动命令(在没有参数模式，是集群模式):</p>
<p><code>sh startup.sh</code></p>
<h2>6.服务注册&amp;发现和配置管理</h2>
<h3>服务注册</h3>
<p><code>curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&amp;ip=20.18.7.10&amp;port=8080'</code></p>
<h3>服务发现</h3>
<p><code>curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=nacos.naming.serviceName'</code></p>
<h3>发布配置</h3>
<p><code>curl -X POST &quot;http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&amp;group=test&amp;content=helloWorld&quot;</code></p>
<h3>获取配置</h3>
<p><code>curl -X GET &quot;http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&amp;group=test&quot;</code></p>
<h2>5.关闭服务器</h2>
<h3>Linux/Unix/Mac</h3>
<p><code>sh shutdown.sh</code></p>
</div></div></section><footer class="footer-container" data-reactid="121"><div class="footer-body" data-reactid="122"><img src="/img/nacos_gray.png" data-reactid="123"/><div class="cols-container" data-reactid="124"><div class="col col-12" data-reactid="125"><h3 data-reactid="126">愿景</h3><p data-reactid="127">Nacos 通过提供简单易用的动态服务发现、服务配置、服务共享与管理等服务基础设施，帮助用户在云原生时代，在私有云、混合云或者公有云等所有云环境中，更好的构建、交付、管理自己的微服务平台，更快的复用和组合业务服务，更快的交付商业创新的价值，从而为用户赢得市场。</p></div><div class="col col-6" data-reactid="128"><dl data-reactid="129"><dt data-reactid="130">文档</dt><dd data-reactid="131"><a href="/zh-cn/docs/what-is-nacos.html" target="_self" data-reactid="132">概览</a></dd><dd data-reactid="133"><a href="/zh-cn/docs/quick-start.html" target="_self" data-reactid="134">快速开始</a></dd><dd data-reactid="135"><a href="/zh-cn/docs/contributing.html" target="_self" data-reactid="136">开发者指南</a></dd></dl></div><div class="col col-6" data-reactid="137"><dl data-reactid="138"><dt data-reactid="139">资源</dt><dd data-reactid="140"><a href="/zh-cn/community/index.html" target="_self" data-reactid="141">社区</a></dd></dl></div></div><div class="copyright" data-reactid="142"><span data-reactid="143">@ 2018 The Nacos Authors | An Alibaba Middleware (Aliware) Project</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
</body>
</html>